<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/base.jsp"%>
<%@ include file="/module/taglibs.jsp"%>
<%@ include file="/module/nocache.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>责任分工文件列表页面</title>
<%@ include file="/module/js.jsp"%>
</head>
<body>
	<form action="#" name="Form" id="Form" method="post">
		<input type="hidden" name="idList" id="idList" />
		<%@ include file="/module/orderField.jsp"%>
		<table cellpadding="1" cellspacing="1" border="0">
			<tr>
				<td><input type="button" id="btnQuery" value="查 询"
					class="inputButton" /></td>
					
					 <kl:permission permisstionList="${permisstionList}"
					currentUser="${_login_console_user}"
					currentCatalogId="<%=CatalogUtils.getCatalogId(\"ZHDJ_DFLZ_ZRFGWJ\")%>"
					key="add">
						<td><input type="button" id="btnAdd" value="添 加" class="inputButton" /></td>
					 </kl:permission>
				
				 <kl:permission permisstionList="${permisstionList}"
					currentUser="${_login_console_user}"
					currentCatalogId="<%=CatalogUtils.getCatalogId(\"ZHDJ_DFLZ_ZRFGWJ\")%>"
					key="delete">
						<td><input type="button" id="btnDelete" value="删 除" class="inputButton" /></td>
					 </kl:permission>
				<td><input type="button" id="btnExport" value="导 出"
					class="inputButton" /></td>
					<td><input type="button" id="btnCreateTotalTable" value="生成汇总列表"
					class="inputButton" /></td>
			</tr>
		</table>
		<table cellpadding="1" cellspacing="1">
			<tr>
				<td>年份： <select id="zRNF" name="zRNF" class="selectList2">
						<option value="0">全部</option>
						<c:forEach items="${yearList}" var="data" varStatus="index">
							<option value="${data.zRNF}">${data.zRNF}年</option>
							
						</c:forEach>
				</select>
				</td>
				
			</tr>
		</table>
		<br />
		<table id="dg" style="width: 100%;"
			data-options="pagination:true,collapsible:true,url:'${basePath}/partyResponsibility/list',method:'post',remoteSort:true">
			<thead>
				<tr>
					<th
						data-options="field:'zrId',checkbox:true,width:80,align:'center'"></th>
					<th
						data-options="field:'zRNFYear',nowrap:true,width:200,align:'center',sortable:true,formatter:go2Info">年份</th>
						<th
						data-options="field:'fbRq',nowrap:true,width:200,align:'center',sortable:true">发布日期</th>
						<th
						data-options="field:'zrBt',nowrap:true,width:200,align:'center',sortable:true">标题</th>
					<th
						data-options="field:'creatorName',nowrap:true,width:200,align:'center',sortable:true">创建人</th>
					<th
						data-options="field:'createTime',nowrap:true,width:200,align:'center',sortable:true">创建时间</th>
				</tr>
			</thead>
		</table>
	</form>
	<script type="text/javascript">
		$(document)
				.ready(
						function() {

							$('#dg')
									.datagrid(
											{
												rowStyler : function(index, row) {
												},
												onLoadSuccess : function(data) {//加载完毕后获取所有的checkbox遍历
													if (data.rows.length > 0) {
													}
												},
											});
							//查询
							$('#btnQuery').click(function() {
								$('#dg').datagrid('load', {
									zRNF:$("#zRNF").val()
								});
							});
							
							$('#btnCreateTotalTable')
							.click(
									function() {
										window.location.href = "${basePath}/partyResponsibility/index2";
									});
							
							$('#easyui-ck').click(function() {
								var data = $("#dg").datagrid("getSelections");
								for (var i = 0; i < data.length; i++) {
								}
							});
							$('#btnAdd')
									.click(
											function() {
												window.location.href = "${basePath}/partyResponsibility/addInInt";
											});
							
							
							$('#btnExport')
							.on(
									'click',
									function() {
										layer
												.confirm(
														"您确定要导出吗?",
														{
															icon : 3,
															title : '提示',
															skin : 'layer-ext-moon'
														},
														function(index) {
																layer.closeAll('dialog');//解决导出成功后提示框不关闭的问题
																document.Form.action = "${basePath}/partyResponsibility/exportPartyResponsibility";
																document.Form.submit();
														});
									});
							
							$('#btnDelete')
									.click(
											function() {
												$("#idList").val("");
												var count = 0;
												var idList = new Array();
												var sels = $("#dg").datagrid(
														"getSelections");
												for ( var i in sels) {
													idList.push(sels[i].zrId);
													count++;
												}

												if (count == 0) {
													layer.alert(
															"您至少选择一条删除记录信息", {
																icon : 3
															});
													return false;
												} else {
													layer
															.confirm(
																	"您是否删除当前选中数据信息",
																	{
																		icon : 3,
																		title : '提示',
																		skin : 'layer-ext-moon'
																	},
																	function(
																			index) {
																		$(
																				"#idList")
																				.val(
																						idList);
																		document.Form.action = "${basePath}/partyResponsibility/delete";
																		document.Form
																				.submit();
																	},
																	function(
																			index) {
																		layer
																				.close(index);
																	});
												}
											});
						});
		if ("${msg}" != "") {
			layer.alert("${msg}", {
				icon : 6
			});
		}
		
		function go2Info(value, row, index) {
		       return "<a href='${basePath}/partyResponsibility/info?id=" + row.zrId + "'>" + value + "</a>";
		  }
	</script>
</body>
</html>
